#ifndef VDSMILE_H
#define VDSMILE_H

#include <QString>

class VDSmile
{
public:
	VDSmile(const QString &code, const QString &file, const QString &comment)
		: m_code(code)
		, m_file(file)
		, m_comment(comment)
	{}

	const QString &code() const { return m_code; }
	const QString &file() const { return m_file; }
	const QString &comment() const { return m_comment; }

	void setCode(const QString &code) { m_code = code; }
	void setFile(const QString &file) { m_file = file; }
	void setComment(const QString &comment) { m_comment = comment; }

private:
	QString m_code;
	QString m_file;
	QString m_comment;

private:
	VDSmile();
	VDSmile(const VDSmile&);
	VDSmile& operator=(const VDSmile&);
};

//////////////////////////////////////////////////////////////////////////
#include <QVector>
#include <QDomElement>

class VDSmiles
{
public:
	VDSmiles();
	~VDSmiles();

	void clear();
	bool isEmpty() const;

	bool saveToXml() const;
	bool loadFromXml();

	QString getFolderPath() const {return m_folderPath;}
	QString getSmilePath(const VDSmile* s) const;

	void addSmile(VDSmile* s);
	VDSmile* getSmile(int ind) const;
	bool delSmile(int ind);

	QString insertSmileToStr(const QString& str) const;

public:
	QVector<VDSmile*> m_smiles;
	QString m_folderPath;

private:
	QDomElement makeSmileElement(QDomDocument &doc, const VDSmile *s) const;
	QDomElement makeSmileProperty(QDomDocument &doc, const QString &name, 
		const QString &value) const;

	void readSmileProperty(const QDomElement &elem, VDSmile *s);
};


#endif // VDSMILE_H
